home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / config / auto-aux / signals.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-18  |  473 b   |  26 lines  |  [TEXT/R*ch]

  1. /* To determine the semantics of signal handlers
  2.    (System V: signal is reset to default behavior on entrance to the handler
  3.     BSD: signal handler remains active). */
  4.  
  5. #include <stdio.h>
  6. #include <signal.h>
  7.  
  8. int counter;
  9.  
  10. void sig_handler(dummy)
  11.      int dummy;
  12. {
  13.   counter++;
  14. }
  15.  
  16. int main(argc, argv)
  17.      int argc;
  18.      char ** argv;
  19. {
  20.   signal(SIGINT, sig_handler);
  21.   counter = 0;
  22.   kill(getpid(), SIGINT);
  23.   kill(getpid(), SIGINT);
  24.   return (counter == 2 ? 0 : 1);
  25. }
  26.